package vek.GUI.Infoview;

import java.awt.Color;
import javax.swing.JEditorPane;

/**
 * Contains functionality used to show descriptions of the POIs.
 * @author Christian, Michal og Jakob (Hold 1, gruppe 2)
 */
public class InfoDescriptionShower extends JEditorPane{
    
    private String description;
    
    /**
     * Shows the description of the POI.
     * @param desc the description of the POI to be shown
     */
    
    public InfoDescriptionShower(String desc)
    {
        setEditable(false);
        description = desc;
        setContentType("text/html");
        
        //setPreferredSize(new Dimension(100,100));
        //setMaximumSize(new Dimension(100,100));
        setDescription(description);
        setBackground(Color.LIGHT_GRAY);
    }
    
    /**
     * Makes the description of the POI into HTML if needed, currently does nothing
     * @param s the description of the POI as a String
     * @return the description of the POI as a String
     */

    private String makeDescIntoHTML(String s)
    {
        return s;
    }
    
    /**
     * sets the text of the JEditorPane to that of the description variable
     * @param s the description of the POI which is to be shown in the JEditorPane
     */
    
    public void setDescription(String s)
    {
        setContentType("text/html");
        makeDescIntoHTML(s);
        setText(s);
    }

}
